﻿
Namespace Collections
    Public Interface ISortableCollection(Of T)
        Inherits ICollection(Of T)

        ''' <summary>
        ''' Maintains a list of criteria the collection is sorted by.
        ''' </summary>
        ''' <remarks>Maintains a collection of SortCriteria that the collection is sorted by. Cleared out on "SortBy" and appended to on "ThenBy".</remarks>
        ReadOnly Property SortConditions() As IList(Of SortCriteria(Of T))
        ''' <summary>
        ''' Specifies the First Condition to sort the collection by.
        ''' </summary>
        ''' <remarks>Specifies the first condition under which the collection should be sorted. If the Collection is already sorted, this function will clear all previous sort conditions and add the specified criteria as the first criteria under which to sort.</remarks>
        ''' <returns>Should always return "me" to return the current instance of the implementing class.</returns>
        Function SortBy(ByVal criteria As SortCriteria(Of T)) As ISortableCollection(Of T)
        ''' <summary>
        ''' Appends additional sort criteria and sorts the collection accordingly.
        ''' </summary>
        ''' <remarks>
        ''' Specifies additional criteria under which to sort the collection.
        ''' Should throw an exception if the collection is not already sorted.
        ''' </remarks>
        ''' <returns>Returns the sorted instance of implementing class (should always return me), allowing the caller to chain sort conditions.</returns>
        Function ThenSortBy(ByVal criteria As SortCriteria(Of T)) As ISortableCollection(Of T)

    End Interface
End Namespace